package services;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.aton.db.SessionFactory;

import models.DrCourtMonthModelVo;
import models.mapper.CourtStatisticMapper;

public class CourtStatisticService {
	/**
	 * 获取指定时间内的开庭数据
	 * @param now
	 * @param lastMonth
	 * @return
	 */
	public static List<DrCourtMonthModelVo> getFoldLineByDate(Date startDate, Date endDate) {
		SqlSession ss=SessionFactory.INSTANCE.getSqlSessionWithoutAutoCommit();
		try{
			CourtStatisticMapper mapper=ss.getMapper(CourtStatisticMapper.class);
			return mapper.getFoldLineByDate(startDate,endDate);
		}finally{
			ss.close();
		}
	}

	public static List<DrCourtMonthModelVo> getMonthPieChartByDate(Date startDate, Date endDate) {
		SqlSession ss=SessionFactory.INSTANCE.getSqlSessionWithoutAutoCommit();
		try{
			CourtStatisticMapper mapper=ss.getMapper(CourtStatisticMapper.class);
			return mapper.getMonthPieChartByDate(startDate,endDate);
		}finally{
			ss.close();
		}
	}

}
